<template>
  <template v-for="item in menuList" :key="item.path">
    <template v-if="item && item.children?.length >= 1">
      <el-sub-menu :index="item.indexPath">
        <template #title>
          <el-icon>
            <Component :is="item.icon" />
          </el-icon>
          <span>{{ item.title }}</span>
        </template>
        <menuTree :menuList="item.children"></menuTree>
      </el-sub-menu>
    </template>
    <template v-if="item.children == null || !item?.children">
      <el-menu-item :index="item.indexPath">
        <el-icon>
          <Component :is="item.icon" />
        </el-icon>
        <span>{{ item.title }}</span>
      </el-menu-item>
    </template>
  </template>
</template>
<script setup>
defineProps({ menuList: Array })
</script>
